package gui;

import initializers.Initializer;

import java.awt.Component;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import configuration.WindowSettings;

public abstract class AbstractMainFrame 
{

	protected JFrame mainFrame;
	protected JTextArea workingFile;
	protected List<Initializer<? extends Component>> initializers;

	public JFrame getFrame()
	{
		return mainFrame;
	}
	
	public JTextArea getWorkingFile()
	{
		return workingFile;
	}
	
	protected void setLookAndFeel(String lookAndFeel) {
		try 
		{
			UIManager.setLookAndFeel(lookAndFeel);
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) 
		{
			e.printStackTrace();
		}
	}

	protected void initializeMainFrame() {
		mainFrame.setSize(WindowSettings.MAIN_WIDTH, WindowSettings.MAIN_HEIGHT);
		mainFrame.setResizable(false);
		
		setInitializers();
		initialize();
		
		mainFrame.setVisible(true);
	}
	
	protected abstract void initialize();
	
	protected abstract void setInitializers();

}
